<template>
  <div id="app">
    <ul class="caipu">
          <li v-for="item in arr2" :data-caipuid="item.id">
              <img :src="item.img" alt="" @click="caipugo">
              <p @click="caipugo">{{item.title}}</p>
              <div>
                  <span>{{item.shoucang}} 收藏</span>
                  <span>{{username1}}</span>
              </div>
          </li>
      </ul>
  </div>
</template>

<script>
export default {
    props:['username1','arr2'],
    data() {
      return {
        // arr2:[]
      }
    },
    methods: {
      caipugo(e){
this.$router.push({  path: `/menudetail/${e.target.parentNode.dataset.caipuid}` });
      }
    },
    mounted() {
    //     this.$axios('/cook').then((res)=>{
    //   this.arr2=res.data
    // })
    },
  }
</script>


<style scoped='true'>
*{
  margin: 0;
  padding: 0;
}
li{
    list-style-type:none
}
#app{
  min-height: 300px;
}
.caipu{
  width: 1080px;
  overflow: hidden;
}
.caipu li {
  width: 277px;
  /* height: 435px; */
  margin: 0 80px 30px 0;
  float: left;
  border: 1px solid #f3f3f3;
}
.caipu li img {
  width: 277px;
  height: 216px;
}
.caipu li p{
    margin: 10px ;
    white-space: nowrap;
  overflow: hidden;
      font-size: 16px;
      cursor: pointer;
}
.caipu li p:hover{
    color: #dd3915;
}
.caipu li div{
    margin: 0 10px;
    white-space: nowrap;
    overflow: hidden;
    padding-bottom: 7px;
}
.caipu li div span{
    color: #909090;
    padding:0 7px;
    font-size: 12px;
}
.caipu li div span:first-child{
   padding:0 7px 0 0;
    border-right: 1px solid #909090;
}
.caipu li div span:last-child:hover{
    cursor: pointer;
    background-color: rgb(44, 44, 44);
    color:#ccc ;
}
</style>